<?php
namespace app\mobile\validate;

use think\Validate;

/**
 * Class Shop
 * @package app\mobileWeb\validate 店铺认证验证
 */
class Shop extends Validate
{
    protected $rule = [
        'name|姓名'  =>    'require|max:3',
        'number_id|身份证号码'    =>  'require|checkData',
        'title'     =>  'require|max:10'
    ];

    protected $message = [
        'name.require'   =>  '姓名不能为空',
        'name.max' =>  '姓名过长',
        'number_id.require'  =>  '身份证号码不能为空',
        'title.require'     =>  '店铺名称不能为空',
        'title.max'     =>  '店铺名称字数过多'
    ];

    protected $scene = [
        'auth'  =>  ['name','number_id'],
        'create'    =>  ['title']
    ];
    protected function checkData($value){
        $result = isCreditNo($value);
        return  $result ? true : '证件号码不正确';
    }
}